from django.shortcuts import render

# Create your views here.
from rest_framework.generics import ListAPIView

from home.models import Banner
from home.serializers import BannerModelSerializer

from luffyapi.settings import constants
# BANNER_LENGTH=10
# 查询数据
class BannerListAPIView(ListAPIView):
    queryset = Banner.objects.filter(is_show=True,is_deleted=False).order_by("-orders","-id")[:constants.BANNER_LENGTH]
    serializer_class = BannerModelSerializer
